<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_folder" :rules="rules" label-width="100px" id="mvcfm">
          <div class="form-unit">
            <a v-for="dict in s_tree_menu" @click="handleNodeClick(dict)" type='primary'>{{dict.__desc}}></a>
          </div>
          <el-button @click="gotoPage('2F3C0A9C46BF4A7DBA4006460E202D43?&cpopup=reload'+vueparams+'')" type='primary' size="mini">新文件夹</el-button>
          <el-button @click="gotoPage('7C37B97BBA8C47258FB2766704672DE8?&cpopup=reload'+vueparams+'')" type='primary' size="mini">上传文件</el-button>
          <el-button @click="gotoPage('A0FE9682706D4D63A6F6266DC04915F5?&cpopup=reload'+vueparams+'')" type='primary' size="mini">引用公共文件</el-button>
          <el-button @click="gotoPage('BF93AA4AEEA84B1A80BE3E8FF52E8847?&cpopup=reload'+vueparams+'')" type='primary' size="mini">流程文件</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 文件夹 </span>
          </div>
          <el-table :data="s_folder">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="d_folder('&CMID4='+scope.row.folder_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="目录" prop="">
              <template slot-scope="scope">
                <img src='images/icons/talent/nopic.jpg' width='23' height='19' />
              </template>
            </el-table-column>
            <el-table-column label="文件夹名" prop="folder_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/psi/product/ProductFiles?CMID9='+scope.row.folder_id+''+vueparams+'')" type='primary'>{{scope.row.subject}}</el-link>
              </template>
            </el-table-column>
          </el-table>
          <div class="form-unit">
            <span class="mvc-title-left"> 文件列表 </span>
          </div>
          <el-table :data="s_file">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="d_files('&CMID4='+scope.row.item_id+'')">删除</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_link('&CMID4='+scope.row.link_id+'')">移除引用</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('0BD52F8F5AF74219B7B9736CF015CCE2?&CMID4='+scope.row.item_id+''+vueparams+'')">增加版本</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="文件" prop="item_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/psi/product/ProductFilesVersion?CMID4='+scope.row.item_id+''+vueparams+'')" type='primary'>{{scope.row.subject}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="client_filename">
            </el-table-column>
            <el-table-column label="尺寸" prop="size">
            </el-table-column>
            <el-table-column label="版本" prop="version">
            </el-table-column>
            <el-table-column label="修改日期" prop="modified">
            </el-table-column>
          </el-table>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'技术文件'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ProductTec',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_folder: [],
        s_file: [],
        s_tree_menu: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "C1BDE411EFF7473EAF5F658AF81F2689",
        name: "产品目录右菜单",
        selected: "技术文件"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/product/ProductAction/productTec?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_files(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/product/ProductAction/d_files?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_link(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/product/ProductAction/d_link?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_folder(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/product/ProductAction/d_folder?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      handleOutline(data) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/product/ProductAction/s_tree_menu?' + this.vueparams,
        }).then(data => {
          this.s_tree_menu = data.s_tree_menu;
          this.s_tree_menu = this.s_tree_menu.reverse();
        })
      },
    },
  }
</script>
